<template>
	<view class="index">
		<view class="cell">
			<u-cell-group>
				<u-cell-item title="我的头像" :arrow="false">
					<view slot="right-icon">
						<u-avatar :size="60" :src="userinfo.avatar"></u-avatar>
					</view>
				</u-cell-item>
				<u-cell-item title="退出登录" @click="logout" v-show="isLogin"></u-cell-item>
			</u-cell-group>
		</view>
		<u-toast ref="Toast"></u-toast>
	</view>
</template>

<script>
	import {mapState,mapGetters,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				
			};
		},
		methods: {
			...mapMutations(['clearUserinfo']),
			logout(){
				this.$refs.Toast.show({
					title: '退出登录成功',
					type: 'success',
					callback: ()=>{
						this.clearUserinfo()
						this.$Router.pushTab({name: 'user.index'})
					}
				})
			}
		},
		computed: {
			...mapState(['userinfo']),
			...mapGetters(['isLogin'])
		}
	}
</script>

<style lang="scss" scoped>
	.index{
		
	}
</style>
